{extend name="$admin_layout" /}
{block name="style"}
<style>
    .table>tbody>tr>td {
        padding: 15px;
        font-size: 14px;
    }
    .select-link {
        display: inline-block;
        width: 70px;
        height: 34px;
        line-height: 34px;
        text-align: center;
        border-radius: 0 16px 16px 0;
        border: 1px solid #b6dafc;
        color:#067fe0;
        background-color: #ecf5ff;
        cursor: pointer;
    }
</style>
{/block}
{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="box nav-tabs-custom">
            <div class="box-header with-border">
                <h3 class="box-title">{:lang('编辑广告')} <small style="color:red"> </small></h3>
                <div class="close close_crm_set_bar icon-del" onclick="closelayer()"></div>
            </div>
            <div class="box-body tab-content">
                <div class="tab-pane active">
                    <div class="block-content" style="max-width: 600px;">
                        <!-- 表单验证请保留id="form"，否则验证不起作用 -->
                        <form class="form row" parent_reload="1" name="form" id="form" onkeydown="if(event.keyCode==13){findinput();return false;}" autocomplete="on" action="" method="post" data-validator-option="{timely:1, theme:'bootstrap'}">

                            <input type="hidden" name="id" value="{$info.id}" />
                            <input type="hidden" name="__token__" value="dcd8ab641edf2f18243b80691befadf3">
                            <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12" id="form_group_typeid">
                                <div class="col-xs-12 label-title" for="typeid">{:lang('所属广告位')}</div>
                                <div class="col-sm-12">
                                    <select class="select2 form-control select2-hidden-accessible" id="typeid" name="typeid" data-select2-id="typeid" tabindex="-1" aria-hidden="true">
                                        {volist name="list_type"  id="cate"}
                                        <option value="{$cate.id}" {if strval($cate.id)==strval($info.typeid)}selected{/if}>{$cate.name}</option>
                                        {/volist}
                                    </select>
<!--                                    <span class="select2 select2-container select2-container&#45;&#45;default" dir="ltr" data-select2-id="1" style="width: 100%;"><span class="selection"><span class="select2-selection select2-selection&#45;&#45;single" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-labelledby="select2-typeid-container"><span class="select2-selection__rendered" id="select2-typeid-container" role="textbox" aria-readonly="true" title="{:lang('引导图')}"><span class="select2-selection__clear" data-select2-id="3">×</span>{:lang('引导图')}</span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span></span></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>-->
                                </div>
                            </div>

                            <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12" id="form_group_name">
                                <div class="col-xs-12 label-title" for="name">{:lang('广告名称')}</div>
                                <div class="col-sm-12">
                                    <input class="form-control" type="text" id="name" name="name" value="{$info.name}" placeholder="{:lang('请输入广告名称')}">
                                </div>
                            </div>

                            <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12" id="form_group_thumb">
                                <div class="col-xs-12 label-title" for="thumb" style="text-align: left;">{:lang('图片')}</div>
                                <div class="col-xs-12 js-upload">
                                    <div id="file_list_thumb" class="uploader-list" style="float:left">
                                        <div class="file-item thumbnail">
                                            <a data-magnify="gallery" data-caption="" href="{$info.thumb|get_file_url}">
                                                <img data-original="" src="{$info.thumb|get_file_url}" width="100">
                                            </a>
                                            <i class="fa fa-times-circle remove-picture"></i>
                                        </div>
                                    </div>
                                    <input type="hidden" name="thumb"  value="{$info.thumb}" data-multiple="false" data-watermark='' data-thumb='' data-size="0" data-ext='' />
                                    <div style="float:left" id="picker_thumb" class="js-upload-image-atlas"><div class="webuploader-pick"></div></div>
                                    <div class="clearfix"></div>
                                </div>
                            </div>

                            <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12" id="form_group_href">
                                <div class="col-xs-12 label-title" for="href" id="myLink">{:lang('链接')}</div>
                                <div class="col-sm-12" style="display: flex;">
                                    <input class="form-control" type="text" id="href" name="href" value="{$info.href}"
                                           placeholder="{:lang('请输入链接')}" style="width: calc(100% - 72px);">
                                    <span class="select-link">{:lang('点击选择')}</span>
                                </div>
                            </div>

                            <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12" id="form_group_sort">
                                <div class="col-xs-12 label-title" for="sort">{:lang('排序')}</div>
                                <div class="col-sm-12">
                                    <input class="form-control" type="number" id="sort" name="sort" value="{$info.sort}" placeholder="{:lang('请输入排序')}">
                                </div>
                            </div>

                            <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12" id="form_group_status">
                                <div class="col-xs-12 label-title" for="status" style="margin-bottom: 14px;">{:lang('立即启用')}</div>
                                <div class="col-xs-12">
                                    <label class="pr10">
                                        <div class="iradio_minimal-red " data-icheck="status" aria-checked="false" aria-disabled="false" style="position: relative;"><input {if $info.status == 0} checked="" {/if}type="radio"  data-toggle="icheck" name="status" id="status1" value="0" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins></div>
                                        否        </label>
                                    <label class="pr10">
                                        <div class="iradio_minimal-red " data-icheck="status" aria-checked="false" aria-disabled="false" style="position: relative;"><input {if $info.status == 1} checked="" {/if} type="radio"  data-toggle="icheck" name="status" id="status2" value="1"  style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins></div>
                                        是        </label>
                                </div>
                            </div>

                            <div class="form-group col-md-12 col-xs-12">
                                <div class="col-xs-12">
                                    <button class="btn btn-primary btn-flat" type="submit"> {:lang('提交')} </button>
                                    <button class="btn btn-default btn-flat" type="button" onclick="closelayer()"> {:lang('关闭')}
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__PLUG__/vue/vue.min.js"></script>
<script src="__PLUG__/vue/vue-resource.min.js"></script>
<script>
    const _link = document.querySelector('.select-link')
    _link.addEventListener('click', () => {
        window.parent.navEditSelectLink((callData) => {
            document.querySelector('#href').value = callData
        })
    })

    function closelayer() {
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        parent.layer.close(index);
    }
</script>
{/block}